package com.mdinfo.system.web;

import com.mdinfo.base.common.bean.CommonResult;
import com.mdinfo.system.param.DeptParam;
import com.mdinfo.system.service.IDeptService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * Created by Administrator on 2017/11/29.
 */
@RestController
@RequestMapping("/sys/dept")
public class DeptController {

    @Resource
    private IDeptService deptService;

    @RequestMapping("/list")
    public CommonResult<?> list(@Valid DeptParam.ListOwnParam param){
        return deptService.listOwn(param);
    }

    @RequestMapping("/listTree")
    public CommonResult<?> listTree(){
        return deptService.listTreeOwn();
    }

    @RequestMapping("/add")
    public CommonResult<?> add(@Valid DeptParam.AddParam param){
        return deptService.add(param);
    }

    @RequestMapping("/modify")
    public CommonResult<?> modify(@Valid DeptParam.ModifyParam param){
        return deptService.modify(param);
    }

    @RequestMapping("/delete")
    public CommonResult<?> delete(@Valid DeptParam.DeleteParam param){
        return deptService.delete(param);
    }

}
